﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Untitled Document</title>
    <style type="text/css">
        body {
            font-family: Arial, Helvetica, sans-serif;
            font-size: 12px;
            text-align: center;
        }

        a {
            text-decoration: none;
        }

        #all {
            widht: 100%;
            text-align: center;
            margin: auto;
        }

        #main {
            width: 96%;
            line-height: 1.8;
            margin: auto;
            border: 1px #ccc dashed;
            text-align: left;
            text-indent: 2em;
        }
        .txtable{
            width: 900px;
            border: 1px solid #b6b6b6;
            border-collapse: collapse;
        }
        td{
            border: 1px solid #b6b6b6;
        }
    </style>
</head>

<body>
<div id="all">

    <a th:href="@{/toSave}">添加</a>
<table class="txtable">
<!--    表头-->
    <thead>
        <tr>
            <td>用户名</td>
            <td>地址</td>
            <td>性别</td>
            <td>生日</td>
            <td>操作</td>
        </tr>
    </thead>
    <tbody>
<!--    thymeleaf跟jsp的el，jstl用法其实差不多-->
    <tr th:each="emp:${list}">
        <td th:text="${emp.username}">用户名</td>
        <td th:text="${emp.pAddr}">地址</td>
        <td th:text="${emp.gender == 1?'男':'女'}">性别</td>
        <td th:text="${#dates.format(emp.birth, 'yyyy-MM-dd')}">生日</td>
        <td>
<!--            可以直接利用这种括号的方式然后传参-->
            <a th:href="@{/getById(empId=${emp.pid})}">修改</a>
            <a th:href="@{/delete(empId=${emp.pid})}">删除</a>
        </td>
    </tr>
    </tbody>
</table>
</div>
</body>
</html>
